package com.itboye.ihomebank.adapter;

import java.util.List;

import android.content.Context;

import com.itboye.ihomebank.R;
import com.itboye.ihomebank.bean.KeyOfLockBean;
import com.itboye.ihomebank.support.commonadapter.MutiplyCommonAdapter;
import com.itboye.ihomebank.support.commonadapter.ViewHolder;

/**
 * 钥匙用户管理
 * 
 */
public class YongHuGuanLiAdapter extends MutiplyCommonAdapter<KeyOfLockBean> {

	int position;
	List<KeyOfLockBean> datas;

	public YongHuGuanLiAdapter(Context context, List<KeyOfLockBean> datas,
			int... layoutId) {
		super(context, datas, layoutId);
		this.datas = datas;
	}

	@Override
	public int getItemViewType(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void getItemPosition(int position) {
		this.position = position;

	}

	@Override
	public void convert(ViewHolder holder, KeyOfLockBean t, int type,
			int position) {
		holder.setText(R.id.guanli_title, t.getNickname()+"("+t.getKeyId()+")");
		holder.setText(R.id.guanli_zhuangtai, t.getKeyStatus());
		try {
			int startTime = Integer.parseInt(t.getStart());
			int endTime = Integer.parseInt(t.getEnd());
			if (startTime == 0 && endTime == 0) {
				holder.setText(R.id.guanli_leibie, "永久");
			}
		} catch (Exception e) {
			// TODO: handle exception
			holder.setText(R.id.guanli_leibie, "限时");
		}

	}

}
